# Created by 黄景涛
# DATE: 2025/5/21
import logging
from logging import getLogger

logging.basicConfig(
    format="%(asctime)s - %(levelname)s - %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S",
    level=logging.DEBUG
)

logger = getLogger()


# eg1: 位置占位
pattern = '早上好，%s先生，这是第 %d 次光临！'
data = ("张三", 10)
logger.info(pattern % data)


# eg2：关键字占位
pattern = "\n学生姓名：%(name)s\n年龄：%(age)s\n学校：%(school)s"
data = {
      "name": "张三",
      "age": 17,
      "school": "深圳大学"
    }
logger.info(pattern % data)

